// 元信息
const meta = {
    requiresAuth: true,
    keepAlive: true
}

// 路由框架 懒加载方式加载路由
const routerFrame = {
    /**
     * Router两种模式 hash & history，默认hash
     * hash则带#，history不带#
     * 同时后端要进行代理配置（ 如nginx）
     **/
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'login',
            component: resolve => require(['@/pages/login/login'], resolve)
        },
        {
            path: '/course',
            name: 'course',
            component: resolve => require(['@/pages/course'], resolve),
            children: [
                {
                    path: 'business',
                    name: 'courseBusiness',
                    component: resolve => require(['@/pages/course/business'], resolve)
                },
                {
                    path: 'editor',
                    name: 'courseEditor',
                    component: resolve => require(['@/pages/course/editor'], resolve)
                }
            ]
        },
        {
            path: '/traineeHome',
            name: 'traineeHome',
            meta: {
                ...meta
            },
            component: resolve => require(['@/pages/trainee/traineeHome'], resolve)
        },
        {
            path: '/home',
            name: 'home',
            meta: {
                ...meta
            },
            component: resolve => require(['@/pages/home/home'], resolve),
            children: [
                /** 系统管理 ***/
                {
                    path: 'role',
                    name: 'role',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '系统管理'
                            },
                            {
                                page: '/home/role',
                                title: '角色管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/system/role/role'], resolve)
                },
                {
                    path: 'user',
                    name: 'user',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '系统管理'
                            },
                            {
                                page: '/home/user',
                                title: '用户管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/system/user/user'], resolve)
                },
                {
                    path: 'department',
                    name: 'department',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '系统管理'
                            },
                            {
                                page: '/home/department',
                                title: '部门管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/system/department/department'], resolve)
                },
                {
                    path: 'trainee',
                    name: 'trainee',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '系统管理'
                            },
                            {
                                page: '/home/trainee',
                                title: '学员管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/system/trainee/trainee'], resolve)
                },
                {
                    path: 'log',
                    name: 'log',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '系统管理'
                            },
                            {
                                page: '/home/log',
                                title: '系统日志'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/system/log/log'], resolve)
                },
                /** 基础材料 **/
                {
                    path: 'mediaClass',
                    name: 'mediaClass',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/imageClass',
                                title: '素材分类'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/media/mediaClass'], resolve)
                },
                {
                    path: 'media',
                    name: 'media',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/media',
                                title: '素材资源'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/media/media'], resolve)
                },
                {
                    path: 'transClass',
                    name: 'transClass',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/transClass',
                                title: '交易分类'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/transaction/transClass'], resolve)
                },
                {
                    path: 'transaction',
                    name: 'transaction',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/transaction',
                                title: '交易模版'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/transaction/transaction'], resolve)
                },
                {
                    path: 'evidenClass',
                    name: 'evidenClass',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/evidenClass',
                                title: '凭证分类'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/evidence/evidenClass'], resolve)
                },
                {
                    path: 'evidence',
                    name: 'evidence',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/evidence',
                                title: '凭证模版'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/evidence/evidence'], resolve)
                },
                {
                    path: 'counter',
                    name: 'counter',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '基础材料'
                            },
                            {
                                page: '/home/counter',
                                title: '柜台模版'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/material/counter/counter'], resolve)
                },
                {
                    path: 'businessClass',
                    name: 'businessClass',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '业务管理'
                            },
                            {
                                page: '/home/businessClass',
                                title: '业务分类'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/business/businessClass'], resolve)
                },
                {
                    path: 'business',
                    name: 'business',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '业务管理'
                            },
                            {
                                page: '/home/business',
                                title: '业务模版'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/business/business'], resolve)
                },
                /** 学习管理 **/
                {
                    path: 'studyTask',
                    name: 'studyTask',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '学习管理'
                            },
                            {
                                page: '/home/studyTask',
                                title: '学习任务'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/study/studyTask/studyTask'], resolve)
                },
                {
                    path: 'trainTask',
                    name: 'trainTask',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '学习管理'
                            },
                            {
                                page: '/home/trainTask',
                                title: '培训任务'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/study/trainTask/trainTask'], resolve)
                },
                /** 考试管理 **/
                {
                    path: 'paperManagement',
                    name: 'paperManagement',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '考试管理'
                            },
                            {
                                page: '/home/paperManagement',
                                title: '试卷管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/exam/paperManagement/paperManagement'], resolve)
                },
                {
                    path: 'examManagement',
                    name: 'examManagement',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '考试管理'
                            },
                            {
                                page: '/home/examManagement',
                                title: '考试管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/exam/examManagement/examManagement'], resolve)
                },
                /** 知识管理 **/
                {
                    path: 'classification',
                    name: 'classification',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '知识管理'
                            },
                            {
                                page: '/home/classification',
                                title: '知识分类'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/knowledge/classification/classification'], resolve)
                },
                {
                    path: 'document',
                    name: 'document',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '知识管理'
                            },
                            {
                                page: '/home/document',
                                title: '文档管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/knowledge/document/document'], resolve)
                },
                {
                    path: 'video',
                    name: 'video',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '知识管理'
                            },
                            {
                                page: '/home/video',
                                title: '视频管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/knowledge/video/video'], resolve)
                },
                {
                    path: 'answer',
                    name: 'answer',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '知识管理'
                            },
                            {
                                page: '/home/answer',
                                title: '问答管理'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/knowledge/answer/answer'], resolve)
                },
                /** 报告管理 **/
                {
                    path: 'studyReport',
                    name: 'studyReport',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '报告管理'
                            },
                            {
                                page: '/home/studyReport',
                                title: '学习报告'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/report/studyReport/studyReport'], resolve)
                },
                {
                    path: 'examReport',
                    name: 'examReport',
                    meta: {
                        ...meta,
                        nodes: [
                            {
                                page: '/home',
                                title: '报告管理'
                            },
                            {
                                page: '/home/examReport',
                                title: '考试报告'
                            }
                        ]
                    },
                    component: resolve => require(['@/pages/report/examReport/examReport'], resolve)
                }
            ]
        },
        // 打字练习
        {
            path: '/typingTraining',
            name: 'typingTraining',
            meta: {
                ...meta
            },
            component: resolve => require(['@/pages/typingTraining/typingTraining'], resolve)
        }
    ]
}

export default {
    ...routerFrame
}
